// pages/house/RentalHouseDetail/com/manage/com/landlord-item/landlord-item.js
Component({

  /**
   * 组件的配置
   */
  options: {
    styleIsolation: 'isolated',
    pureDataPattern: /^_/
  },

  /**
   * 组件的属性列表
   */
  properties: {
    landlord: {
      type: Object,
      value: {}
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    isShowMobile: false,
  },

  /**
   * 组件的生命周期
   */
  lifetimes: {
    attached: function () {},
    detached: function () {},
  },

  /**
   * 页面的生命周期
   */
  pageLifetimes: {
    show: function () {

    },
    hide: function () {
      // 页面被隐藏
    },
    resize: function (size) {
      // 页面尺寸变化
    }
  },

  /**
   * 组件的方法列表
   */
  methods: {
    onChangeSecret() {
      this.setData({
        isShowMobile: !this.data.isShowMobile
      })
    },

    onDelLandlord() {
      const {
        id,
      } = this.data.landlord || {}
      wx.showModal({
        title: '提示',
        content: '您是否确定删除手机号？',
        success: (res) => {
          if (res.confirm) {
            this.triggerEvent('delLandlord', id)
          } else if (res.cancel) {}
        }
      })
    },

    onEditLandlord() {
      const {
        id,
      } = this.data.landlord || {}
      this.triggerEvent('editLandlord', id)
    }

  }
})